//
//  HGMusicFourCollectionViewCell.m
//  悦享
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "HGMusicFourCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation HGMusicFourCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageView1 = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageView1];
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        
        self.descLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_descLabel];
        
        self.laImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_laImageView];
        
        
    }
    return self;
}

- (void)setModel:(HGMusicDataModel *)model{
    _model = model;
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _nameLabel.text = _model.name;
    _descLabel.text = _model.desc;
    
    _laImageView.image = [UIImage imageNamed:@"iconfont-roundright.png"];
    
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    _imageView1.frame = CGRectMake(10, 2, layoutAttributes.frame.size.width / 4-10, layoutAttributes.frame.size.height - 4);
    
    _nameLabel.frame = CGRectMake(layoutAttributes.frame.size.width / 4-2 + 20,10 , layoutAttributes.frame.size.width - (layoutAttributes.frame.size.width / 4-2 + 10) - 50 , 30);
    _descLabel.frame = CGRectMake(layoutAttributes.frame.size.width / 4-2 + 20, 35, layoutAttributes.frame.size.width - (layoutAttributes.frame.size.width / 4-2+10) - 60 , 30);
    _descLabel.font = [UIFont systemFontOfSize:12];
    _descLabel.textColor = [UIColor lightGrayColor];
    _descLabel.numberOfLines = 2;
    _laImageView.frame = CGRectMake(layoutAttributes.frame.size.width - 50,(layoutAttributes.frame.size.height - 30)/2, 30, 30);
    
}

@end
